﻿USE [GestionePolveri]
GO

/****** Object:  Table [GP].[QuickFiltri]    Script Date: 04/04/2013 09:31:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [GP].[QuickFiltri](
	[IDFiltro] [int] IDENTITY(1,1) NOT NULL,
	[Applicazione] [char](5) NULL,
	[Descrizione] [varchar](150) NOT NULL,
	[DateFrom] [datetime] NULL,
	[DateTo] [datetime] NULL,
 CONSTRAINT [PK_QuickFiltri] PRIMARY KEY CLUSTERED 
(
	[IDFiltro] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO



/*****************************************************************************/

USE [GestionePolveri]
GO

/****** Object:  Table [GP].[QuickFiltriImpianti]    Script Date: 04/04/2013 09:31:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [GP].[QuickFiltriImpianti](
	[IDFiltro] [int] NOT NULL,
	[IDImpianto] [int] NOT NULL,
 CONSTRAINT [PK_QuickFiltriImpianti] PRIMARY KEY CLUSTERED 
(
	[IDFiltro] ASC,
	[IDImpianto] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [GP].[QuickFiltriImpianti]  WITH CHECK ADD  CONSTRAINT [FK_QuickFiltriImpianti_Impianti] FOREIGN KEY([IDImpianto])
REFERENCES [GP].[Impianti] ([IDImpianto])
GO

ALTER TABLE [GP].[QuickFiltriImpianti] CHECK CONSTRAINT [FK_QuickFiltriImpianti_Impianti]
GO

ALTER TABLE [GP].[QuickFiltriImpianti]  WITH CHECK ADD  CONSTRAINT [FK_QuickFiltriImpianti_QuickFiltri] FOREIGN KEY([IDFiltro])
REFERENCES [GP].[QuickFiltri] ([IDFiltro])
GO

ALTER TABLE [GP].[QuickFiltriImpianti] CHECK CONSTRAINT [FK_QuickFiltriImpianti_QuickFiltri]
GO



/*****************************************************************************/

USE [GestionePolveri]
GO

/****** Object:  Table [GP].[QuickFiltriFamiglie]    Script Date: 04/03/2013 21:55:28 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [GP].[QuickFiltriFamiglie](
	[IDFiltro] [int] NOT NULL,
	[IDFamiglia] [int] NOT NULL,
 CONSTRAINT [PK_QuickFiltriFamiglie] PRIMARY KEY CLUSTERED 
(
	[IDFiltro] ASC,
	[IDFamiglia] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [GP].[QuickFiltriFamiglie]  WITH CHECK ADD  CONSTRAINT [FK_QuickFiltriFamiglie_AnagFamiglie] FOREIGN KEY([IDFamiglia])
REFERENCES [GP].[AnagFamiglie] ([IDFamiglia])
GO

ALTER TABLE [GP].[QuickFiltriFamiglie] CHECK CONSTRAINT [FK_QuickFiltriFamiglie_AnagFamiglie]
GO

ALTER TABLE [GP].[QuickFiltriFamiglie]  WITH CHECK ADD  CONSTRAINT [FK_QuickFiltriFamiglie_QuickFiltri] FOREIGN KEY([IDFiltro])
REFERENCES [GP].[QuickFiltri] ([IDFiltro])
GO

ALTER TABLE [GP].[QuickFiltriFamiglie] CHECK CONSTRAINT [FK_QuickFiltriFamiglie_QuickFiltri]
GO




